﻿//
// key.hpp
// ~~~~~~~
//

#ifndef YUTOPP_BASIC_KEY_HPP
#define YUTOPP_BASIC_KEY_HPP

#include <string>

namespace webapp
{
	namespace basic
	{
		//認証データ
		template<typename String>
		class basic_key
		{
			typedef String basic_text;

		public:
			basic_key() {}

			basic_key( const basic_text& username, const basic_text& password )
				: username_( username )
				, password_( password )
			{}

			void set_username( const basic_text& username )
			{
				username_ = username;
			}

			void set_password( const basic_text& password )
			{
				password_ = password;
			}

			const basic_text& get_username() const
			{
				return username_;
			}

			const basic_text& get_password() const
			{
				return password_;
			}

			bool is_complete() const
			{
				return !( username_.empty() || password_.empty() );
			}

		private:
			basic_text username_, password_;
		};

		typedef basic_key<std::string> key;
	} // - basic
} // - webapp

#endif /*YUTOPP_BASIC_KEY_HPP*/
